package api

import (
	"blizzard/app/model"
	"blizzard/app/service"
	"blizzard/app/utils/code"
	"blizzard/app/utils/response"
	"github.com/gogf/gf/net/ghttp"
)

var Black = new(apiBlack)

type apiBlack struct {}

func (a *apiBlack) Add(r *ghttp.Request) {
	var (
		data *model.BlackAddParam
		err error
	)
	if err = r.Parse(&data); err != nil {
		response.JsonExit(r, code.ParamError, err.Error())
	}
	if err = service.Black.Add(data); err != nil {
		response.JsonExit(r, code.ServerError, err.Error())
	}
	response.Json(r, code.Success, code.SuccessMsg)
}